<template>
  <div>
    <el-container>


      <el-header>
        <el-card>
          <el-row :gutter="20">
            <el-col :span="6">任务编号:<el-input v-model="xunjian.rwid" style="width: 150px;" disabled></el-input>
            </el-col>
            <el-col :span="6">任务名称:<el-input v-model="xunjian.rwname" style="width: 150px;" disabled></el-input>
            </el-col>
            <el-col :span="6">巡检线路:<el-input v-model="xunjian.xianlu.xlname" style="width: 150px;" disabled></el-input>
            </el-col>
            <el-col :span="6">下发人员:<el-input v-model="xunjian.createby" style="width: 150px;" disabled></el-input>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="6">完成状态:<el-input v-model="xunjian.type" style="width: 150px;" disabled></el-input>
            </el-col>
            <el-col :span="6">是否取消:<el-input v-model="xunjian.runtype==0?'否':'是'" style="width: 150px;" disabled></el-input>
            </el-col>
            <el-col :span="6">下发时间:<el-input v-model="xunjian.createtime" style="width: 150px;" disabled></el-input>
            </el-col>
            <el-col :span="6">完成时间:<el-input v-model="xunjian.okdate" style="width: 150px;" disabled></el-input>
            </el-col>
          </el-row>
          <el-row style="float: left;margin-left: 20px;">
            巡 检 员:<span v-for="item in xunjian.users">
              <el-tag>{{item.uname}}</el-tag>
            </span>
            <el-button type="text" size="medium"    @click="fanhui">返回</el-button>
          </el-row>
          </el-form>
        </el-card>
      </el-header>
      <el-container style="margin-top: 151px;margin-left: 20px;">
        <el-aside style="width: 200px;">
          <el-card>
            <el-table :data="xunjian.xianlu.gantas" highlight-current-row height="290px" @row-click="rowclick">
              <el-table-column label="线路杆塔" prop="gcode"></el-table-column>
            </el-table>
          </el-card>
        </el-aside>
        <el-container>
          <el-main >
            <el-card style="text-align: left;margin-top: -20px;height: 330px;">
              <div style="display: inline-block;width: 500px;">
            <span style="color: #999;">线路编号:</span>
             <span>{{xunjian.xianlu.xlnum}}</span>
             <br>
             <span style="color: #999;">杆塔编号:</span>
              <span>{{gantarow.gcode}}</span>
              <br>
              <span style="color: #999;">有无故障:</span>
              <span v-if="zi.type!=null">{{zi.type}}</span>
              <span v-else>无</span>
              <br>
              <span style="color: #999;">缺陷描述:</span>
              <span v-if="zi.miaoshu!=null">{{zi.miaoshu}}</span>
              <span v-else>无</span>
              <br>
              <span style="color: #999;">巡检员:</span>
              <span v-if="zi.user!=null">{{zi.user.uname}}</span>
              <span v-else>无</span>
              </div>
              <div style="display: inline-block;">
                <span style="color: #999;">缺陷类型:</span>
                <span v-if="zi.quexians!=null" v-for="item in zi.quexians ">
                  <el-tag v-model="item.qxtype"></el-tag>
                </span>
                <span v-else>无</span>
                <br>
                <span style="color: #999;">缺陷级别:</span>
                <span v-if="zi.type!=null">{{zi.type}}</span>
                <span v-else>无</span>
                <br>
                <span style="color: #999;">发现时间:</span>
                <span v-if="zi.findtime!=null">{{zi.findtime}}</span>
                <span v-else>无</span>
                <br>
                <span style="color: #999;">下发时间:</span>
                <span>{{xunjian.createtime}}</span>
              </div>
            </el-card>
          </el-main>

        </el-container>
      </el-container>
    </el-container>


  </div>
</template>

<script>
   import axios from 'axios'
  export default {
    data() {
      return {
        xunjian: {},
        zi:{},
        gantarow:{}
      }
    },
    created() {
      this.xunjian = this.$route.query
      this.xunjian.createtime = this.aaa(this.xunjian.createtime)
    },
    methods: {
      aaa: function(asd) {
        var date = new Date(asd) //时间戳为10位需*1000，时间戳为13位的话不需乘1000
        var Y = date.getFullYear() + '-'
        var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
        var D = date.getDate() + ' '
        var h = date.getHours() + ':'
        var m = date.getMinutes() + ':'
        var s = date.getSeconds()

        console.log(Y + M + D + h + m + s);
        return Y + M + D + h + m + s;
      },
      fanhui:function(){
        this.$router.push({path:'/ZhiDingAndFenPei'})
      },
      rowclick:function(row){
        this.gantarow=row
        console.log(row.gid)
        let postDate=this.$qs.stringify({
          gid:row.gid,
          zhuid:this.xunjian.id
        })
        axios.post("http:localhost:8086/zi/selectByGantaid",postDate).then(vs=>{
        this.zi=vs.data
        })
        console.log(this.zi)
      }
    }
  }
</script>

<style scoped="scoped">

</style>
